const express = require('express')
const app = express()
const path = require('path')

app.use(require('cors')())


app.use('/uploads', express.static(path.join(__dirname, './uploads')))

// 配置数据解析中间件
app.use(express.urlencoded({ extended: false }))
app.use(express.json())
// 配置admin路由
require('./routes/admin')(express, app)
// 配置数据库请求
require('./plugins/db')(app)

app.listen('3000', () => {
  console.log('http://127.0.0.1:3000')
})